import Vue from 'vue'
import VueRouter from 'vue-router'
import Index from '@/views/Index/index.vue'
import Movie from '@/views/Index/movie.vue'
import Series from '@/views/Index/series.vue'
import Variety from '@/views/Index/variety.vue'
import Book from '@/views/Index/book.vue'
import Layout from '@/components/layout.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    redirect: '/layout'   // 路由重定向到布局模板中
  },
  {
    path: '/layout',
    redirect: '/index',   // 路由重定向到首页模板
    component: Layout,
    children: [{
      path: '/index',
      component: Index
    }, {
      path: '/movie',
      component: Movie
    }, {
      path: '/series',
      component: Series
    }, {
      path: '/variety',
      component: Variety
    }, {
      path: '/book',
      component: Book
    }]
  },
]

const router = new VueRouter({
  routes
})

export default router
